The following example builds on Example: A Simple Tab Widget by adding the following features:
This example is included in the file tab_widget_example2.pro in the examples/doc/widgets subdirectory of the IDL distribution. Run this example procedure by entering tab_widget_example2 at the IDL command prompt or view the file in an IDL Editor window by entering .EDIT tab_widget_example2.pro. See Running the Example Code if IDL does not run the program as expected.
The following things about this example are worth noting:
retStruct structure is an example of the kind of information you might pass out of a tab widget, back to a larger widget application. Using an approach like the one here allows the user to set a group of values before sending any of them to the larger application. This may be more efficient than updating the larger application “on the fly” as the user makes changes to the widgets in the tab interface.TWE2_saveValue refers to the fields of the retStruct structure by their indices instead. We do this because while it is not possible to pass the field name in a variable, it is possible to pass the integer index value. Passing the index value of the appropriate field in the retStruct structure as the user value of the widget whose value is being saved allows us to write a single TWE2_saveValue function, rather than one function for each field in the retStruct structure.